package com.chnbst.mbstyun.dao.impl;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import com.chnbst.mbstyun.dao.BaseDao;
import com.chnbst.mbstyun.dao.UserDao;
import com.chnbst.mbstyun.pojo.User;

@Repository
public class UserDaoImpl extends BaseDao<User> implements UserDao {

	@Override
	public void insertUser(User user) {
		super.save(user);
	}

	@Override
	public void deleteUser(User user) {
		super.delete(user);
	}

	@Override
	public User TelExists(String tel) {
	    Query q = createQuery("from User u where u.userValid = '0' and ( u.userTel = ? or u.boundTel = ? )", tel,tel);
		q.setMaxResults(1);
		return (User)q.uniqueResult();
	}
}
